﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:btns="clr-namespace:Eniux.Windows.Controls.Buttons;assembly=Eniux.Windows.Controls"
    xmlns:core="clr-namespace:Eniux.Windows.Controls.Core.Core;assembly=Eniux.Windows.Controls.Core"
    xmlns:converter="clr-namespace:Eniux.Windows.Controls.Core.Converters;assembly=Eniux.Windows.Controls.Core"
    xmlns:wnd="clr-namespace:Eniux.Windows.Controls.WindowCore;assembly=Eniux.Windows.Controls">
    <converter:CornerRadiusConverter x:Key="CR_Converter"/>
    <converter:TransparentToNoTransparent x:Key="TransparentToNoTransparent"/>
    <converter:MarginConverter x:Key="MarginConverter"/>
    <converter:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
    <LinearGradientBrush x:Key="NormalBorderBrush" EndPoint="0.5,1" StartPoint="0.5,0">
        <GradientStop Color="#FF9DB2C0" Offset="0"/>
        <GradientStop Color="#3EFFFFFF" Offset="1"/>
    </LinearGradientBrush>
    <LinearGradientBrush x:Key="SysBtn_MouseOver_Background" EndPoint="0.5,1" StartPoint="0.5,0">
        <GradientStop Color="#FF2FBCF1"/>
        <GradientStop Color="#0084D5FF" Offset="1"/>
        <GradientStop Color="#F200C0CE" Offset="0.25"/>
    </LinearGradientBrush>
    <LinearGradientBrush x:Key="SysBtn_Pressed_Background" EndPoint="0.5,1" StartPoint="0.5,0">
        <GradientStop Color="#FF2FB7F1"/>
        <GradientStop Color="#0084D5FF" Offset="1"/>
        <GradientStop Color="#F200A4CE" Offset="0.25"/>
    </LinearGradientBrush>
    <LinearGradientBrush x:Key="SysCloseBtn_MouseOver_Background" EndPoint="0.5,1" StartPoint="0.5,0">
        <GradientStop Color="#FFDA4A29"/>
        <GradientStop Color="#00F55A20" Offset="1"/>
        <GradientStop Color="#F2FB1B09" Offset="0.25"/>
    </LinearGradientBrush>
    <LinearGradientBrush x:Key="SysCloseBtn_Pressed_Background" EndPoint="0.5,1" StartPoint="0.5,0">
        <GradientStop Color="#FFDA8229"/>
        <GradientStop Color="#00F55A20" Offset="1"/>
        <GradientStop Color="#F2CE0000" Offset="0.25"/>
    </LinearGradientBrush>

    <ControlTemplate x:Key="CommonBtnTemplate" TargetType="Button">
        <Grid x:Name="root" DataContext="{TemplateBinding DataContext}">
            <Border CornerRadius="{TemplateBinding core:AttachWindow.CornerRadius}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}"/>
            <Image x:Name="img" DataContext="{TemplateBinding DataContext}"  Stretch="Fill" Width="12"  Height="12"
                   Source="{TemplateBinding core:AttachWindow.ImageSource}"/>
        </Grid>
        <ControlTemplate.Triggers>
            <Trigger Property="IsMouseOver" Value="True">
                <Setter Property="Background" Value="{Binding Path=(core:AttachWindow.IsMouseOverBackgroundKey),RelativeSource={RelativeSource Self},Mode=TwoWay}"/>
            </Trigger>
            <Trigger Property="IsPressed" Value="True">
                <Setter Property="Background"   Value="{Binding Path=(core:AttachWindow.IsPressedBackgroundKey),RelativeSource={RelativeSource Self}}"/>
                <Setter Property="Margin" Value="1,1,-1,-1" TargetName="img"/>
            </Trigger>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <Style x:Key="SysButtonCommonStyle" TargetType="Button">
        <Setter Property="Width" Value="30"/>
        <Setter Property="Height" Value="18"/>
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="BorderBrush" Value="{StaticResource NormalBorderBrush}"/>
        <Setter Property="BorderThickness" Value="0"/>
        <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
        <Setter Property="core:AttachWindow.IsMouseOverBackgroundKey" Value="{DynamicResource SysBtn_MouseOver_Background}"/>
        <Setter Property="core:AttachWindow.IsPressedBackgroundKey" Value="{DynamicResource SysBtn_Pressed_Background}"/>
        <Setter Property="Template" Value="{StaticResource CommonBtnTemplate}"/>
    </Style>
    <Style TargetType="{x:Type ResizeGrip}">
        <Setter Property="Template">
          <Setter.Value>
            <ControlTemplate TargetType="{x:Type ResizeGrip}">
                <Canvas    ClipToBounds="True"   Width="10" Height="10" >
                    <Line SnapsToDevicePixels="True"  X1="10" X2="0" Y1="0" Y2="10"  Stretch="Fill" Stroke="{TemplateBinding Background}" />
                    <Line SnapsToDevicePixels="True"  X1="10" X2="23" Y1="23" Y2="10"  Stretch="Fill" Stroke="{TemplateBinding Background}"/>
                    <Line SnapsToDevicePixels="True" X1="10" X2="26" Y1="26" Y2="10"  Stretch="Fill" Stroke="{TemplateBinding Background}"/>
                </Canvas>
            </ControlTemplate>
          </Setter.Value>
        </Setter>
      </Style>
    <ControlTemplate x:Key="WindowTemplate" TargetType="{x:Type wnd:WindowBase}">
      <AdornerDecorator>
            <Border DataContext="{Binding RelativeSource={RelativeSource TemplatedParent}}" 
                    Background="Transparent" >
                <Grid x:Name="PART_MainGrid" Margin="2" >
                    <Border x:Name="NoDWMBackground" 
                            Visibility="{Binding IsDwmEnabled,RelativeSource={RelativeSource Mode=TemplatedParent},Converter={StaticResource BooleanToVisibilityConverter}}"
                            Background="{DynamicResource Theme_Window_Background_NoTransparent}"
                            CornerRadius="{TemplateBinding core:AttachWindow.CornerRadius}"/>
                    <Border x:Name="Window_Border"
                              Visibility="{Binding IsDwmEnabled,RelativeSource={RelativeSource Mode=TemplatedParent},Converter={StaticResource BooleanToVisibilityConverter}}"
                            Margin="1,0,1,1" Background="#9BF8F8F8" />
                    <Border x:Name="WindowBackground" Background="{Binding  Background,RelativeSource={RelativeSource Mode=TemplatedParent}}"  CornerRadius="{TemplateBinding core:AttachWindow.CornerRadius}"/>

                    <Border x:Name="WindowImageBackground" Background="{DynamicResource Theme_Window_BackImage}" ClipToBounds="True" CornerRadius="{TemplateBinding core:AttachWindow.CornerRadius}">
                    </Border>

                    <Border x:Name="WindowBackground_Header"  Margin="0,1,0,0" Height="60" VerticalAlignment="Top" Background="{DynamicResource WindowBackground_Header}" CornerRadius="{Binding Path=(core:AttachWindow.CornerRadius),Converter={StaticResource CR_Converter},ConverterParameter=TopLeft_TopRight,RelativeSource={RelativeSource Mode=TemplatedParent}}"/>
                    <Border x:Name="WindowBackground_Center" Background="{DynamicResource WindowBackground_Center}" Margin="0,60,0,40" />
                    <Border x:Name="WindowBackground_Bottom"  Margin="0" Height="40" VerticalAlignment="Bottom" Background="{DynamicResource WindowBackground_Bottom}" CornerRadius="{Binding Path=(core:AttachWindow.CornerRadius),Converter={StaticResource CR_Converter},ConverterParameter=BottomLeft_BottomRight,RelativeSource={RelativeSource Mode=TemplatedParent}}"/>
                    <Border x:Name="PART_TitleBar" Margin="{TemplateBinding ResizeBorderThickness}" Background="Transparent" VerticalAlignment="Top" Height="{TemplateBinding CaptionHeight}"/>

                    <ContentPresenter Margin="{Binding CaptionHeight,Converter={StaticResource MarginConverter},ConverterParameter=Top,RelativeSource={RelativeSource Mode= TemplatedParent}}"/>
                    <StackPanel Margin="5,5,0,0" x:Name="PART_HeaderArea"  VerticalAlignment="Top" Orientation="Horizontal">
                        <Image x:Name="PART_Icon" Width="16" Height="16" Stretch="Fill" HorizontalAlignment="Left" VerticalAlignment="Center" SnapsToDevicePixels="True" Source="{TemplateBinding Icon}"/>
                        <TextBlock Margin="5,0,0,0" Text="{TemplateBinding Title}" Foreground="{TemplateBinding Foreground}" VerticalAlignment="Center"/>
                    </StackPanel>

                    <StackPanel x:Name="PART_SysBtnsPanel" Margin="0,-1,0,0" Visibility="{TemplateBinding core:AttachWindow.Sys_IsVisibleSystemButtonsArea}" HorizontalAlignment="Right"  VerticalAlignment="Top" Orientation="Horizontal">
                        <Menu Background="Transparent" BorderThickness="0" Visibility="Collapsed">
                            <MenuItem Background="Transparent" Height="20" Width="20" x:Name="PART_ExtendMenu">
                                <MenuItem.Icon>
                                    <Image Source="/Eniux.Windows.Controls.Themes;component/Images/NWindow/extend.png" Width="11" Height="8" SnapsToDevicePixels="True"/>
                                </MenuItem.Icon>
                            </MenuItem>
                        </Menu>
                            <Button x:Name="PART_MinButton"  Command="{x:Static wnd:WindowBase.MinimizeCommand}"
                        core:AttachWindow.ImageSource="{TemplateBinding Sys_MinBtnContentImage}"  
                        Style="{DynamicResource SysButtonCommonStyle}"></Button>
                        <Button x:Name="PART_MaxButton"  Command="{x:Static wnd:WindowBase.MaximizeCommand}"
                        core:AttachWindow.ImageSource="{TemplateBinding Sys_MaxBtnContentImage}"  
                        BorderThickness="1,0,0,0" 
                        Style="{DynamicResource SysButtonCommonStyle}"></Button>
                        <Button x:Name="PART_NormalButton"  Command="{x:Static wnd:WindowBase.NormalizeCommand}"
                        core:AttachWindow.ImageSource="{TemplateBinding Sys_RestoreBtnContentImage}"  
                        BorderThickness="1,0,0,0" 
                        Style="{DynamicResource SysButtonCommonStyle}"></Button>
                        <Button x:Name="PART_CloseButton"  Command="{x:Static wnd:WindowBase.CloseCommand}"
                        BorderThickness="1,0,0,0" Width="40"
                        core:AttachWindow.CornerRadius="{Binding Path=(core:AttachWindow.CornerRadius),Converter={StaticResource CR_Converter},ConverterParameter=TopRight,RelativeSource={RelativeSource Mode=TemplatedParent}}"
                        core:AttachWindow.ImageSource="{TemplateBinding Sys_CloseBtnContentImage}"
                        core:AttachWindow.IsMouseOverBackgroundKey="{DynamicResource SysCloseBtn_MouseOver_Background}"
                        core:AttachWindow.IsPressedBackgroundKey="{DynamicResource SysCloseBtn_Pressed_Background}"
                        Style="{DynamicResource SysButtonCommonStyle}"></Button>
                    </StackPanel>
                    <ResizeGrip x:Name="PART_ResizeGrip"
                                Background="{TemplateBinding core:AttachWindow.Sys_GripStroke}"
                                HorizontalAlignment="Right"
                                VerticalAlignment="Bottom" Focusable="False" 
                                Cursor="SizeNWSE" Visibility="Collapsed"/>
                </Grid>
            </Border>
        </AdornerDecorator>
    <ControlTemplate.Triggers>
      <Trigger Property="IsNonClientAreaActive" Value="False">
      </Trigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="ResizeMode" Value="CanResizeWithGrip"/>
          <Condition Property="WindowState" Value="Normal"/>
        </MultiTrigger.Conditions>
        <Setter Property="Visibility" TargetName="PART_ResizeGrip" Value="Visible"/>
      </MultiTrigger>
        <Trigger Property="ResizeMode" Value="NoResize">
            <Setter Property="Visibility" TargetName="PART_MinButton" Value="Collapsed"/>
            <Setter Property="Visibility" TargetName="PART_MaxButton" Value="Collapsed"/>
            <Setter Property="BorderThickness" TargetName="PART_CloseButton" Value="0"/>
                <Setter Property="ResizeBorderThickness" Value="0"/>
        </Trigger>
        <Trigger Property="ResizeMode" Value="CanMinimize">
            <Setter Property="Visibility" TargetName="PART_MaxButton" Value="Collapsed"/>
        </Trigger>
        <MultiTrigger>
        <MultiTrigger.Conditions>
            <Condition Property="IsDwmEnabled" Value="False"/>
            <Condition Property="WindowState" Value="Maximized"/>
        </MultiTrigger.Conditions>
            <Setter Property="Margin" TargetName="PART_SysBtnsPanel" Value="0,0,0,0"/>
            <Setter Property="Visibility" TargetName="PART_MaxButton" Value="Collapsed"/>
            <Setter Property="Margin" TargetName="PART_HeaderArea" Value="4,6,0,0"/>
        </MultiTrigger>
        <MultiTrigger>
            <MultiTrigger.Conditions>
                <Condition Property="IsDwmEnabled" Value="False"/>
                <Condition Property="WindowState" Value="Normal"/>
            </MultiTrigger.Conditions>
            <Setter Property="Margin" TargetName="PART_MainGrid" Value="0"/>
            <Setter Property="Margin" TargetName="WindowBackground" Value="0,1,0,0"/>
            <Setter Property="Margin" TargetName="WindowBackground_Header" Value="1,1,1,0"/>
            <Setter Property="Margin" TargetName="WindowBackground_Bottom" Value="1,0,1,1"/>
            <Setter Property="Margin" TargetName="WindowBackground_Center" Value="1,60,1,40"/>
        </MultiTrigger>
        <MultiTrigger>
            <MultiTrigger.Conditions>
                <Condition Property="IsDwmEnabled" Value="True"/>
                <Condition Property="WindowState" Value="Maximized"/>
                <Condition SourceName="PART_ExtendMenu" Property="HasItems" Value="False"/>
            </MultiTrigger.Conditions>
                <Setter Property="Visibility" TargetName="PART_ExtendMenu" Value="Collapsed"/>
                <Setter Property="Margin" TargetName="PART_SysBtnsPanel" Value="0,4,0,0"/>
                <Setter Property="Visibility" TargetName="PART_MaxButton" Value="Collapsed"/>
                <Setter Property="Margin" TargetName="PART_HeaderArea" Value="8,10,0,0"/>
        </MultiTrigger>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsDwmEnabled" Value="True"/>
                    <Condition Property="WindowState" Value="Maximized"/>
                    <Condition SourceName="PART_ExtendMenu" Property="HasItems" Value="True"/>
                </MultiTrigger.Conditions>
                <Setter Property="Visibility" TargetName="PART_ExtendMenu" Value="Visible"/>
                <Setter Property="Margin" TargetName="PART_SysBtnsPanel" Value="0,4,0,0"/>
                <Setter Property="Visibility" TargetName="PART_MaxButton" Value="Collapsed"/>
                <Setter Property="Margin" TargetName="PART_HeaderArea" Value="8,10,0,0"/>
            </MultiTrigger>
            <Trigger Property="WindowState" Value="Normal">
        <Setter Property="Visibility" TargetName="PART_NormalButton" Value="Collapsed"/>
      </Trigger>
        
      <Trigger Property="IsIconVisible" Value="False">
        <Setter Property="Visibility" TargetName="PART_Icon" Value="Collapsed"/>
      </Trigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
            <Condition Property="Source" SourceName="PART_Icon" Value="{x:Null}"/>
            <Condition Property="IsIconVisible"  Value="True"/>
        </MultiTrigger.Conditions>
        <Setter TargetName="PART_Icon" Property="Visibility" Value="Collapsed"/>
      </MultiTrigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
    <ControlTemplate x:Key="MessageBoxTemplate" TargetType="{x:Type wnd:WindowBase}">
        <AdornerDecorator >
            <Border DataContext="{Binding RelativeSource={RelativeSource TemplatedParent}}" 
                    Background="Transparent" >
                <Grid x:Name="PART_MainGrid" Margin="2">
                    <Border x:Name="NoDWMBackground" 
                            Visibility="{Binding IsDwmEnabled,RelativeSource={RelativeSource Mode=TemplatedParent},Converter={StaticResource BooleanToVisibilityConverter}}"
                            Background="{DynamicResource Theme_Window_Background_NoTransparent}"
                            CornerRadius="{TemplateBinding core:AttachWindow.CornerRadius}"/>
                    <Border x:Name="Window_Border"
                              Visibility="{Binding IsDwmEnabled,RelativeSource={RelativeSource Mode=TemplatedParent},Converter={StaticResource BooleanToVisibilityConverter}}"
                            Margin="1,0,1,1" Background="#9BF8F8F8" />
                    <Border x:Name="WindowBackground" Background="{Binding  Background,RelativeSource={RelativeSource Mode=TemplatedParent}}"  CornerRadius="{TemplateBinding core:AttachWindow.CornerRadius}"/>
                    <Border x:Name="WindowImageBackground" Background="{DynamicResource Theme_Window_BackImage}" ClipToBounds="True" CornerRadius="{TemplateBinding core:AttachWindow.CornerRadius}">
                    </Border>
                    <Border x:Name="WindowBackground_Header"  Margin="0,1,0,0" Height="60" VerticalAlignment="Top" Background="{DynamicResource WindowBackground_Header}" CornerRadius="{Binding Path=(core:AttachWindow.CornerRadius),Converter={StaticResource CR_Converter},ConverterParameter=TopLeft_TopRight,RelativeSource={RelativeSource Mode=TemplatedParent}}"/>
                    <Border x:Name="WindowBackground_Center" Background="{DynamicResource WindowBackground_Center}" Margin="0,60,0,40" />
                    <Border x:Name="WindowBackground_Bottom"  Margin="0,0,0,0" Height="40" VerticalAlignment="Bottom" Background="{DynamicResource WindowBackground_Bottom}" CornerRadius="{Binding Path=(core:AttachWindow.CornerRadius),Converter={StaticResource CR_Converter},ConverterParameter=BottomLeft_BottomRight,RelativeSource={RelativeSource Mode=TemplatedParent}}"/>
                    <Border x:Name="PART_TitleBar" Margin="{TemplateBinding ResizeBorderThickness}" Background="Transparent" VerticalAlignment="Top" Height="{TemplateBinding CaptionHeight}"/>

                    <Grid Margin="5,30,5,0">
                        <Grid.RowDefinitions>
                            <RowDefinition/>
                            <RowDefinition Height="40"/>
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition/>
                        </Grid.ColumnDefinitions>
                        <RichTextBox Focusable="False"  IsReadOnly="True" BorderBrush="Transparent" Background="Transparent" Visibility="Collapsed"
                                     x:Name="RichTextBox" MaxWidth="420" MaxHeight="500" Grid.ColumnSpan="2" Margin="15" 
                                     ScrollViewer.CanContentScroll="True" ScrollViewer.HorizontalScrollBarVisibility="Auto" 
                                     ScrollViewer.VerticalScrollBarVisibility="Auto" IsReadOnlyCaretVisible="False"
                                     SnapsToDevicePixels="True">
                            <FlowDocument  MaxPageWidth="400" PagePadding="0" >
                                <Paragraph >
                                    <Figure Width="68" Height="68" HorizontalAnchor="ColumnLeft">
                                        <BlockUIContainer>
                                            <Image x:Name="img" Margin="0.5,0.5,-0.5,-0.5" SnapsToDevicePixels="True" Width="48" Height="48" Stretch="Fill" />
                                        </BlockUIContainer>
                                    </Figure>
                                    <Run  Text="{TemplateBinding Content}"/>
                                </Paragraph>
                            </FlowDocument>
                        </RichTextBox>
                        <ScrollViewer SnapsToDevicePixels="True" x:Name="TextBlock" Padding="0"  MaxWidth="420" MaxHeight="500"  Visibility="Collapsed"  Grid.ColumnSpan="2" Margin="15" CanContentScroll="True" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto">
                            <TextBlock Text="{TemplateBinding Content}"  
                                   TextWrapping="Wrap"
                                   MaxWidth="400" 
                                   SnapsToDevicePixels="True"/>
                        </ScrollViewer>
                        <StackPanel KeyboardNavigation.TabNavigation="Cycle" Orientation="Horizontal" Height="40" HorizontalAlignment="Right" Grid.Row="1" Grid.Column="1" Margin="5,0,15,0">
                            <Button x:Name="PART_YesButton" IsDefault="True" Content="{TemplateBinding core:AttachWindow.Sys_YesButtonContent}" Command="{x:Static wnd:WindowBase.YesCommand}" VerticalAlignment="Center"  Margin="0,0,15,0"  Padding="15,5,15,5" MinWidth="69" />
                            <Button x:Name="PART_NoButton"  Content="{TemplateBinding core:AttachWindow.Sys_NoButtonContent}" Command="{x:Static wnd:WindowBase.NoCommand}" VerticalAlignment="Center"  Margin="0,0,15,0" Padding="15,5,15,5" MinWidth="69"/>

                            <Button x:Name="PART_OKButton" IsDefault="True" KeyboardNavigation.AcceptsReturn="True"  Content="{TemplateBinding core:AttachWindow.Sys_OKButtonContent}" Command="{x:Static wnd:WindowBase.OKCommand}" VerticalAlignment="Center"  Margin="0,0,15,0"  Padding="15,5,15,5" MinWidth="69"/>
                            <Button x:Name="PART_CancelButton" IsCancel="True"  Content="{TemplateBinding core:AttachWindow.Sys_CancelButtonContent}" Command="{x:Static wnd:WindowBase.CancelCommand}" VerticalAlignment="Center"  Padding="15,5,15,5" MinWidth="69"/>
                        </StackPanel>
                    </Grid>
                    <StackPanel Margin="5,5,0,0" x:Name="PART_HeaderArea"  VerticalAlignment="Top" Orientation="Horizontal">
                        <TextBlock Margin="5,0,0,0" Text="{TemplateBinding Title}" Foreground="{TemplateBinding Foreground}" VerticalAlignment="Center"/>
                    </StackPanel>

                    <StackPanel x:Name="PART_SysBtnsPanel"  Margin="0,0,0,0" HorizontalAlignment="Right"  VerticalAlignment="Top" Orientation="Horizontal">
                        <Button x:Name="PART_CloseButton"  Command="{x:Static wnd:WindowBase.CloseCommand}"
                        BorderThickness="0" Width="40"
                        core:AttachWindow.CornerRadius="{Binding Path=(core:AttachWindow.CornerRadius),Converter={StaticResource CR_Converter},ConverterParameter=TopRight,RelativeSource={RelativeSource Mode=TemplatedParent}}"
                        core:AttachWindow.ImageSource="{TemplateBinding Sys_CloseBtnContentImage}"
                        core:AttachWindow.IsMouseOverBackgroundKey="{DynamicResource SysCloseBtn_MouseOver_Background}"
                        core:AttachWindow.IsPressedBackgroundKey="{DynamicResource SysCloseBtn_Pressed_Background}"
                        Style="{DynamicResource SysButtonCommonStyle}"></Button>
                    </StackPanel>
                    <ResizeGrip x:Name="PART_ResizeGrip"
                                Background="{TemplateBinding core:AttachWindow.Sys_GripStroke}"
                                HorizontalAlignment="Right"
                                VerticalAlignment="Bottom" Focusable="False" 
                                Cursor="SizeNWSE" Visibility="Collapsed"/>
                </Grid>
            </Border>


        </AdornerDecorator>
        <ControlTemplate.Triggers>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsDwmEnabled" Value="False"/>
                    <Condition Property="WindowState" Value="Normal"/>
                </MultiTrigger.Conditions>
                <Setter Property="Margin" TargetName="PART_MainGrid" Value="0"/>
                <Setter Property="Margin" TargetName="PART_SysBtnsPanel" Value="0,1,0,0"/>
                <Setter Property="Margin" TargetName="WindowBackground" Value="0,1,0,0"/>
                <Setter Property="Margin" TargetName="WindowBackground_Header" Value="1,1,1,0"/>
                <Setter Property="Margin" TargetName="WindowBackground_Bottom" Value="1,0,1,1"/>
                <Setter Property="Margin" TargetName="WindowBackground_Center" Value="1,60,1,40"/>
            </MultiTrigger>
            <Trigger Property="core:AttachWindow.Sys_MessageBoxImage" Value="None">
                <Setter Property="Visibility" TargetName="TextBlock" Value="Visible"/>
            </Trigger>
            <Trigger Property="core:AttachWindow.Sys_MessageBoxImage" Value="Error">
                <Setter Property="Visibility" TargetName="RichTextBox" Value="Visible"/>
                <Setter Property="Source" TargetName="img" Value="/Eniux.Windows.Controls.Themes;component/Images/MessageBoxImage/error.png"/>
            </Trigger>
            <Trigger Property="core:AttachWindow.Sys_MessageBoxImage" Value="Hand">
                <Setter Property="Visibility" TargetName="RichTextBox" Value="Visible"/>
                <Setter Property="Source" TargetName="img" Value="/Eniux.Windows.Controls.Themes;component/Images/MessageBoxImage/hand.png"/>
            </Trigger>
            <Trigger Property="core:AttachWindow.Sys_MessageBoxImage" Value="Stop">
                <Setter Property="Visibility" TargetName="RichTextBox" Value="Visible"/>
                <Setter Property="Source" TargetName="img" Value="/Eniux.Windows.Controls.Themes;component/Images/MessageBoxImage/error.png"/>
            </Trigger>
            <Trigger Property="core:AttachWindow.Sys_MessageBoxImage" Value="Question">
                <Setter Property="Visibility" TargetName="RichTextBox" Value="Visible"/>
                <Setter Property="Source" TargetName="img" Value="/Eniux.Windows.Controls.Themes;component/Images/MessageBoxImage/question.png"/>
            </Trigger>
            <Trigger Property="core:AttachWindow.Sys_MessageBoxImage" Value="Exclamation">
                <Setter Property="Visibility" TargetName="RichTextBox" Value="Visible"/>
                <Setter Property="Source" TargetName="img" Value="/Eniux.Windows.Controls.Themes;component/Images/MessageBoxImage/warning.png"/>
            </Trigger>
            <Trigger Property="core:AttachWindow.Sys_MessageBoxImage" Value="Warning">
                <Setter Property="Visibility" TargetName="RichTextBox" Value="Visible"/>
                <Setter Property="Source" TargetName="img" Value="/Eniux.Windows.Controls.Themes;component/Images/MessageBoxImage/warning.png"/>
            </Trigger>
            <Trigger Property="core:AttachWindow.Sys_MessageBoxImage" Value="Information">
                <Setter Property="Visibility" TargetName="RichTextBox" Value="Visible"/>
                <Setter Property="Source" TargetName="img" Value="/Eniux.Windows.Controls.Themes;component/Images/MessageBoxImage/information.png"/>
            </Trigger>
            <Trigger Property="core:AttachWindow.Sys_MessageBoxImage" Value="Asterisk">
                <Setter Property="Visibility" TargetName="RichTextBox" Value="Visible"/>
                <Setter Property="Source" TargetName="img" Value="/Eniux.Windows.Controls.Themes;component/Images/MessageBoxImage/information.png"/>
            </Trigger>
            <Trigger Property="core:AttachWindow.Sys_MessageBoxButton" Value="OK">
                <Setter Property="Visibility" TargetName="PART_YesButton" Value="Collapsed"/>
                <Setter Property="Visibility" TargetName="PART_NoButton" Value="Collapsed"/>
                <Setter Property="Visibility" TargetName="PART_OKButton" Value="Visible"/>
                <Setter Property="Visibility" TargetName="PART_CancelButton" Value="Collapsed"/>
            </Trigger>
            <Trigger Property="core:AttachWindow.Sys_MessageBoxButton" Value="OKCancel">
                <Setter Property="Visibility" TargetName="PART_YesButton" Value="Collapsed"/>
                <Setter Property="Visibility" TargetName="PART_NoButton" Value="Collapsed"/>
                <Setter Property="Visibility" TargetName="PART_OKButton" Value="Visible"/>
                <Setter Property="Visibility" TargetName="PART_CancelButton" Value="Visible"/>
            </Trigger>
            <Trigger Property="core:AttachWindow.Sys_MessageBoxButton" Value="YesNo">
                <Setter Property="Visibility" TargetName="PART_YesButton" Value="Visible"/>
                <Setter Property="Visibility" TargetName="PART_NoButton" Value="Visible"/>
                <Setter Property="Visibility" TargetName="PART_OKButton" Value="Collapsed"/>
                <Setter Property="Visibility" TargetName="PART_CancelButton" Value="Collapsed"/>
            </Trigger>
            <Trigger Property="core:AttachWindow.Sys_MessageBoxButton" Value="YesNoCancel">
                <Setter Property="Visibility" TargetName="PART_YesButton" Value="Visible"/>
                <Setter Property="Visibility" TargetName="PART_NoButton" Value="Visible"/>
                <Setter Property="Visibility" TargetName="PART_OKButton" Value="Collapsed"/>
                <Setter Property="Visibility" TargetName="PART_CancelButton" Value="Visible"/>
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>
    <Style x:Key="WindowBaseStyle_Default" TargetType="{x:Type wnd:WindowBase}">
        <Setter Property="ResizeMode" Value="CanResize"/>
        <Setter Property="WindowState" Value="Normal"/>
        <Setter Property="core:AttachWindow.CornerRadius" Value="5"/>
        <Setter Property="core:AttachWindow.Sys_GripStroke" Value="{DynamicResource WindowGripStroke}"/>
        <Setter Property="Sys_MinBtnContentImage" Value="/Eniux.Windows.Controls.Themes;component/Images/NWindow/min.png"/>
        <Setter Property="Sys_MaxBtnContentImage" Value="/Eniux.Windows.Controls.Themes;component/Images/NWindow/max.png"/>
        <Setter Property="Sys_RestoreBtnContentImage" Value="/Eniux.Windows.Controls.Themes;component/Images/NWindow/restore.png"/>
        <Setter Property="Sys_CloseBtnContentImage" Value="/Eniux.Windows.Controls.Themes;component/Images/NWindow/close.png"/>
        <Setter Property="core:AttachWindow.Sys_IsVisibleSystemButtonsArea" Value="Visible"/>
        <Setter Property="core:AttachWindow.Sys_YesButtonContent" Value="是"/>
        <Setter Property="core:AttachWindow.Sys_NoButtonContent" Value="否"/>
        <Setter Property="core:AttachWindow.Sys_OKButtonContent" Value="确 定"/>
        <Setter Property="core:AttachWindow.Sys_CancelButtonContent" Value="取消"/>
        <Setter Property="Foreground" Value="{DynamicResource ForegroundBrush_Button}" />
        <Setter Property="FontFamily" Value="SimSun" />
        <Setter Property="FontSize" Value="13" />
        
        <Setter Property="CornerRadius" Value="7"/>
        <Setter Property="CaptionHeight" Value="30"/>
        <Setter Property="Background" Value="{DynamicResource Theme_Window_Background}"/>
        <!--<Setter Property="Fluent:FrameworkHelper.UseLayoutRounding" Value="True"/>-->
        <Style.Triggers>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsDwmEnabled" Value="True"/>
                    <Condition Property="core:AttachWindow.Sys_IsMessageBox" Value="False"/>
                </MultiTrigger.Conditions>
                <Setter Property="Template" Value="{StaticResource WindowTemplate}"/>
            </MultiTrigger>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsDwmEnabled" Value="False"/>
                    <Condition Property="core:AttachWindow.Sys_IsMessageBox" Value="False"/>
                </MultiTrigger.Conditions>
                <Setter Property="Template" Value="{StaticResource WindowTemplate}"/>
            </MultiTrigger>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsDwmEnabled" Value="True"/>
                    <Condition Property="core:AttachWindow.Sys_IsMessageBox" Value="True"/>
                </MultiTrigger.Conditions>
                <Setter Property="MinHeight" Value="50"/>
                <Setter Property="MinWidth" Value="150"/>
                <Setter Property="MaxHeight" Value="600"/>
                <Setter Property="MaxWidth" Value="500"/>
                <Setter Property="ResizeMode" Value="NoResize"/>
                <Setter Property="SizeToContent" Value="Height"/>
                <Setter Property="ShowInTaskbar" Value="False"/>
                <Setter Property="ResizeBorderThickness" Value="0"/>
                <Setter Property="Template" Value="{StaticResource MessageBoxTemplate}"/>
            </MultiTrigger>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsDwmEnabled" Value="False"/>
                    <Condition Property="core:AttachWindow.Sys_IsMessageBox" Value="True"/>
                </MultiTrigger.Conditions>
                <Setter Property="ResizeBorderThickness" Value="0"/>
                <Setter Property="MinHeight" Value="50"/>
                <Setter Property="MinWidth" Value="150"/>
                <Setter Property="MaxHeight" Value="600"/>
                <Setter Property="MaxWidth" Value="500"/>
                <Setter Property="ResizeMode" Value="NoResize"/>
                <Setter Property="SizeToContent" Value="Height"/>
                <Setter Property="ShowInTaskbar" Value="False"/>
                <Setter Property="Template" Value="{StaticResource MessageBoxTemplate}"/>
            </MultiTrigger>
        </Style.Triggers>
    </Style>
    <Style BasedOn="{StaticResource WindowBaseStyle_Default}" x:Key="{x:Type wnd:WindowBase}" TargetType="{x:Type wnd:WindowBase}"/>
</ResourceDictionary>